package com.xiangge.zuoye;

public class Demo6 {
    public static void main(String[] args) {
        double x = -1.5;

        double jdz = getJueduizhi(x);

        System.out.println("绝对值为" + jdz);
    }

    public static double getJueduizhi(double x) {

        if (x<0){
            return x*(-1);
        }else {
            return x;
        }
    }
}
